import React, { useState, useEffect } from 'react'
import store from './redux/store'
import Count from './components/Count'
import Test from './components/Test'

export default function App() {
  const [c, setC] = useState(0)

  useEffect(() => {
    // 当app挂载的时候,要监听redux数据的变化
    store.subscribe(() => {
      //   setC(c + 1)
      //   console.log(store.getState())
      setC((newC) => {
        // newC 一定是最新的c的值
        return newC + 1
      })
    })
  }, [])

  return (
    <div>
      <Count></Count>
      {/* <Test></Test> */}
    </div>
  )
}
